import request from '@/utils/request'

export function getDepartments() {
  return request({
    url: '/company/department',
    method: 'GET'
  })
}

/**
 * 根据id删除部门   接口是根据restful的规则设置的  删除delete 新增post 修改put 获取get
 *
 * */

export function delDepartments(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}
// 新增部门
export function addDepartments(data) {
  return request({
    url: `/company/department`,
    method: 'POST',
    data
  })
}

// 根据部门id获取详情
export function getDepartDetail(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'GET'
  })
}

// 更新部门信息

export function updateDepartments(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'PUT',
    data
  })
}
